package WaiBao;

import java.util.Arrays;

public class LiYiJie {
    public static void main(String[] args) {
        String[] name = {"李家河(班长)", "郭贤青(副班长)", "小李(学习委员)", "白开秀(团支书)", "黄亚辉", "中伦军", "蔡贾蓉", "郭子豪", "周俊雅", "李培波", "李仁杰", "量佩芬",
                "邓丽君", "陈招", "吴军行", "吴梦雨", "谢一忠", "王美玲", "李旺", "黄美", "江钧升", "王雅雯", "杨帆静", "成论", "秦心若", "黄汝村", "黄国美", "成秀德",
                "郭碧晨", "李怡洁(学生)"};//考生本人:李怡洁(学生)
        int[] age = {18,19, 20, 21, 22,21, 18, 18, 19, 19, 18, 19, 18, 22, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 20, 19, 18, 18};//考生年龄：18

        double[] cycad1 = {79, 78, 59, 85, 79, 68, 78, 89, 60, 80, 90, 87, 85, 79, 63, 68, 69, 99, 96, 88, 92, 91, 95, 85, 75, 74, 74, 84, 89, 96};
        double[] cycad2 = {69, 91, 87, 84, 71, 86, 76, 83, 60, 70, 95, 67, 86, 75, 95, 65, 86, 79, 66, 78, 82, 71, 85, 85, 75, 89, 74, 79, 84, 95};
        double[] cycad3 = {87, 83, 99, 74, 85, 75, 63, 69, 80, 69, 73, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 88, 73, 78, 78, 95};

        double twig;//代表每个学生的总分
        double bough;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            twig =  cycad1[i] +  cycad2[i] + cycad3[i];
//            bough = (twig * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +twig);
//            System.out.println(name[i] + "的平均分为:" +  bough);
//        }


        double leaf1 = 0,leaf2 = 0,leaf3 = 0;
        double kont = 0;
//        for (int i = 0; i <cycad1.length; i++) {
//            kont+=cycad1[i];
//        }
//        leaf1 = (kont*1.0)/30;
//        System.out.println("分析化学的班级平均分为:"+ leaf1);
//        double stump = 0;
//        for (int i = 0; i < cycad2.length; i++) {
//            stump+=cycad1[i];
//        }
//        leaf2 = (stump*1.0)/30;
//        System.out.println("线性代数的班级平均分为:"+leaf2);
//        double sum = 0;
//        for (int i = 0; i <cycad3.length; i++) {
//            sum+=cycad1[i];
//        }
//        leaf3 = (sum*1.0)/30;
//        System.out.println("有机化学的班级平均分为:"+ leaf3);



        double root1 = 0,root2 = 0, root3 = 0;//计算每门课的平均分
        double wood1 = 0,wood2 = 0,wood3 = 0;//计算每门课标准差
        double ring1 = 0,  ring2 = 0, ring3 = 0;//计算每门课中位数
        double sap = 0;
        for (int i = 0; i < cycad1.length; i++) {
            sap+=cycad1[i];
        }
        root1 = (sap*1.0)/30;
        System.out.println("分析化学的班级平均分为:"+ root1);
        double Sum = 0;
        for (int i = 0; i < cycad2.length; i++) {
            Sum+=cycad2[i];
        }
        root2 = (Sum*1.0)/30;
        System.out.println("线性代数的班级平均分为:"+root2);
        double sum = 0;
        for (int i = 0; i <cycad3.length; i++) {
            sum+=cycad3[i];
        }
        root3 = (sum*1.0)/30;
        System.out.println("有机化学的班级平均分为:"+ root3);




        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < cycad1.length; i++) {
            c1+= (cycad1[i] - root1)*(cycad1[i] - root1);
        }
        wood1 = Math.sqrt(c1*1.0/30);
        System.out.println("分析化学的班级标准差为:"+ wood1);

        for (int i = 0; i <cycad2.length; i++) {
            c2+= (cycad2[i] - root2)*(cycad2[i] -root2);
        }
        wood2 = Math.sqrt(c2*1.0/30);
        System.out.println("线性代数的班级标准差为:"+ wood2);

        for (int i = 0; i <cycad3.length; i++) {
            c3+= (cycad3[i] - root3)*(cycad3[i] - root3);
        }
        wood3 = Math.sqrt(c3*1.0/30);
        System.out.println("有机化学的班级标准差为:"+wood3);
//
////
////
//        Arrays.sort(cycad1);
//        Arrays.sort(cycad2);
//        Arrays.sort(cycad3);
//        ring1 =( cycad1[14]+cycad1[15])*1.0/2;
//        ring2 =( cycad2[14]+cycad2[15])*1.0/2;
//        ring3 =( cycad3[14]+cycad3[15])*1.0/2;
//        System.out.println("分析化学的中位数为:"+  ring1);
//        System.out.println("线性代数的中位数为:"+  ring2);
//        System.out.println("有机化学学的中位数为:"+  ring3);

    }
}
